﻿
-- ================================================
-- Remarks: 
-- ================================================
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'Dasideen_UserDetails_GetAll')
	BEGIN
		DROP  Procedure  Dasideen_UserDetails_GetAll
	END

GO

CREATE PROCEDURE [Dasideen_UserDetails_GetAll]
-- =============================================
-- Author:		<Sagar s.k>
-- Create date: <02-03-2015>
-- Description:	<Dasideen_UserDetails_GetAll>
-- =============================================
-- Add the parameters for the stored procedure here
	(
				@Sys_IsDeleted int = 0,
				@Sys_OrganizationID int = -1
	)

AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT OFF;

	SELECT     [User].[UserKey], 
	           [User].[UserLoginID], 
			   [User].[UserFirstName], 
			   [User].[UserLastName], 
			   [User].[UserPrimaryEmailID], 
			   [UserProfile].[UserFullName], 
			   [UserProfile].[UserSex], 
			   [UserProfile].[UserContactNumber], 
               [UserProfile].[UserAlternateEmailID], 
			   [User].[Sys_DateOfCreation],
			   [UserProfileImage].[UserProfileImageData]
FROM           [User] LEFT OUTER JOIN [UserProfileImage] 
ON             [User].[UserKey] = [UserProfileImage].[UserKey] LEFT OUTER JOIN [UserProfile] 
ON             [User].[UserKey] = [UserProfile].[UserKey]
WHERE		(
				([User].[Sys_IsDeleted] = @Sys_IsDeleted) AND 
				([User].Sys_OrganizationID = @Sys_OrganizationID)
			)
END
GO
